/*
 企业管理员登录
 * */
function businessLogin() {
    var logintelID = $("#detialbusiness");
    var logintel = logintelID.val();
    var loginpwdID = $("#detialbusinesspwd");
    var loginpwd = loginpwdID.val();
    var verificationCodeID = $("#verificationCode");
    var verificationCode = verificationCodeID.val();
    if ($.trim(logintel) == "") {
        layer.tips('请输入管理员账号', '#detialbusiness', {tips: [3, '#4bcf99']});
        logintelID.focus();
        return false;
    } else {
        loginpwdID.focus();
    }
    if ($.trim(loginpwd) == "") {
        layer.tips('请输入密码', '#detialbusinesspwd', {tips: [3, '#4bcf99']});
        return false;
    } else {
        verificationCodeID.focus();
    }
    if ($.trim(verificationCode) == "") {
        layer.tips('请输入验证码', '#verificationCode', {tips: [1, '#4bcf99']});
        return false;
    }
    // layer.msg('<span><span class="icon-spin icon-spinner"></span>数据加载中...</span>');
    // window.location.href="index.html";
    //获取记住密码
    var remembers = document.getElementsByName('remember');
    var remember = remembers[0];
    var flag = false;
    if (remember.checked) {
        flag = true;
    }

    $.ajax({
        type: "post",
        url: http + "/userlogin",
        data: {
            "username": logintel,
            "password": loginpwd,
            "vcode": verificationCode,
            "remember": flag
        },
        dataType: "json",
        success: function (data) {
            if (data.code == 1) {
                window.location.href = http;
            }
            else {
                layer.msg("*" + data.message);
            }
        }
    });


}
/*
 刷新验证码
 * */
function yzmimg() {
    //layer.load(2, {time: 500});
    url = http + '/authcode?number=' + Math.round(Math.random() * 1000000);
    $("#yzmimg").attr("src", url)
}
$(function () {
    $(".login-contain").fadeIn(1500);
    /*
     给输入框绑定样式
     * */
    $('input').on({
        focus: function () {
            $(this).parent().addClass('acquisitionOfCursor');
        },
        blur: function () {
            $(this).parent().removeClass('acquisitionOfCursor');
        }
    })

    //加载验证码
    $("#yzmimg").attr("src", url)
});